<?php

namespace iBrand\Store\Backend\Console;

use Illuminate\Console\Command;
use DB;

class StoreMenusCommand extends Command
{
	protected $signature = 'import:store-backend-menus';

	protected $description = 'import store backend menus';

	public function handle()
	{
		$lastOrder   = DB::table(config('admin.database.menu_table'))->max('order');
		$storeParent = DB::table(config('admin.database.menu_table'))->where('title', '商城管理')->where('parent_id', 0)->first();
		if (!$storeParent) {
			$storeBackendParentId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => 0,
				'order'      => ++$lastOrder,
				'title'      => '商城管理',
				'icon'       => 'iconfont icon-shangchengguanli-',
				'blank'      => 1,
				'uri'        => 'store/goods?view=1',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$storeBackendParentId = $storeParent->id;
		}

		$storeSettings = DB::table(config('admin.database.menu_table'))->where('title', '商城设置')->where('parent_id', $storeBackendParentId)->first();
		if (!$storeSettings) {
			$storeSettingsId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => ++$lastOrder,
				'title'      => '商城设置',
				'icon'       => 'iconfont icon-shangchengshezhi-',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$storeSettingsId = $storeSettings->id;
		}

		$globalSetting = DB::table(config('admin.database.menu_table'))->where('title', '全局设置')->where('parent_id', $storeSettingsId)->first();
		if (!$globalSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '全局设置',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/shopSetting',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*[
			'parent_id'  => $storeSettingsId,
			'order'      => ++$lastOrder,
			'title'      => '员工内购',
			'icon'       => '',
			'blank'      => 1,
			'uri'        => 'store/setting/employee',
			'created_at' => date('Y-m-d H:i:s', time()),
			'updated_at' => date('Y-m-d H:i:s', time()),
		]*/
		$pointSetting = DB::table(config('admin.database.menu_table'))->where('title', '积分设置')->where('parent_id', $storeSettingsId)->first();
		if (!$pointSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '积分设置',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/point',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*$priceProtect = DB::table(config('admin.database.menu_table'))->where('title', '价格保护')->where('parent_id', $storeSettingsId)->first();
		if (!$priceProtect) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '价格保护',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/price/protection',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		$afterSaleSetting = DB::table(config('admin.database.menu_table'))->where('title', '售后设置')->where('parent_id', $storeSettingsId)->first();
		if (!$afterSaleSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '售后设置',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/refund-reason',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*$invoiceSetting = DB::table(config('admin.database.menu_table'))->where('title', '发票设置')->where('parent_id', $storeSettingsId)->first();
		if (!$invoiceSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '发票设置',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/invoice',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		/*$toolSetting = DB::table(config('admin.database.menu_table'))->where('title', '工具管理')->where('parent_id', $storeSettingsId)->first();
		if (!$toolSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '工具管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/tool',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		/*$onlineServiceSetting = DB::table(config('admin.database.menu_table'))->where('title', '客服设置')->where('parent_id', $storeSettingsId)->first();
		if (!$onlineServiceSetting) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeSettingsId,
				'order'      => ++$lastOrder,
				'title'      => '客服设置',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/setting/onlineService',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		$goodsManage = DB::table(config('admin.database.menu_table'))->where('title', '商品管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$goodsManage) {
			$goodsManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => ++$lastOrder,
				'title'      => '商品管理',
				'icon'       => 'iconfont icon-shangpinshezhi-',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$goodsManageId = $goodsManage->id;
		}

		$modelManage = DB::table(config('admin.database.menu_table'))->where('title', '模型管理')->where('parent_id', $goodsManageId)->first();
		if (!$modelManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '模型管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/models',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$specManage = DB::table(config('admin.database.menu_table'))->where('title', '规格管理')->where('parent_id', $goodsManageId)->first();
		if (!$specManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '规格管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/specs',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$paramsManage = DB::table(config('admin.database.menu_table'))->where('title', '参数管理')->where('parent_id', $goodsManageId)->first();
		if (!$paramsManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '参数管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/attribute',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$brandManage = DB::table(config('admin.database.menu_table'))->where('title', '品牌管理')->where('parent_id', $goodsManageId)->first();
		if (!$brandManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '品牌管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/brand',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$categoryManage = DB::table(config('admin.database.menu_table'))->where('title', '分类管理')->where('parent_id', $goodsManageId)->first();
		if (!$categoryManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '分类管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/category',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$goodsList = DB::table(config('admin.database.menu_table'))->where('title', '商品列表')->where('parent_id', $goodsManageId)->first();
		if (!$goodsList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '商品列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/goods?view=1',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*$goodsCodeManage = DB::table(config('admin.database.menu_table'))->where('title', '商品注册码')->where('parent_id', $goodsManageId)->first();
		if (!$goodsCodeManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '商品注册码',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/registrations',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$shoppingCartList = DB::table(config('admin.database.menu_table'))->where('title', '购物车列表')->where('parent_id', $goodsManageId)->first();
		if (!$shoppingCartList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $goodsManageId,
				'order'      => ++$lastOrder,
				'title'      => '购物车列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/cart',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		$discountManage = DB::table(config('admin.database.menu_table'))->where('title', '促销管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$discountManage) {
			$parentDiscountId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '促销管理',
				'icon'       => 'iconfont icon-cuxiaoguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$parentDiscountId = $discountManage->id;
		}

		$discountActivity = DB::table(config('admin.database.menu_table'))->where('title', '促销活动管理')->where('parent_id', $parentDiscountId)->first();
		if (!$discountActivity) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '促销活动管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/discount',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$couponManage = DB::table(config('admin.database.menu_table'))->where('title', '优惠券管理')->where('parent_id', $parentDiscountId)->first();
		if (!$couponManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '优惠券管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/coupon',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*$singleDiscount = DB::table(config('admin.database.menu_table'))->where('title', '单品折扣管理')->where('parent_id', $parentDiscountId)->first();
		if (!$singleDiscount) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '单品折扣管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/single-discount',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$suitManage = DB::table(config('admin.database.menu_table'))->where('title', '套餐管理')->where('parent_id', $parentDiscountId)->first();
		if (!$suitManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '套餐管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/suit',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$seckillManage = DB::table(config('admin.database.menu_table'))->where('title', '秒杀管理')->where('parent_id', $parentDiscountId)->first();
		if (!$seckillManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '秒杀管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/seckill',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$multiGrouponManage = DB::table(config('admin.database.menu_table'))->where('title', '多人拼团管理')->where('parent_id', $parentDiscountId)->first();
		if (!$multiGrouponManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '多人拼团管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/multiGroupon',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$newUserGift = DB::table(config('admin.database.menu_table'))->where('title', '新人进店礼')->where('parent_id', $parentDiscountId)->first();
		if (!$newUserGift) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '新人进店礼',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/gift/new_user',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$directionalCoupon = DB::table(config('admin.database.menu_table'))->where('title', '定向发券')->where('parent_id', $parentDiscountId)->first();
		if (!$directionalCoupon) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '定向发券',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/directional/coupon',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$birthdayGift = DB::table(config('admin.database.menu_table'))->where('title', '生日礼')->where('parent_id', $parentDiscountId)->first();
		if (!$birthdayGift) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '生日礼',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/gift/birthday',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$weChatGroup = DB::table(config('admin.database.menu_table'))->where('title', '微信群管理')->where('parent_id', $parentDiscountId)->first();
		if (!$weChatGroup) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $parentDiscountId,
				'order'      => $lastOrder++,
				'title'      => '微信群管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/promotion/wechat/group',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$orderManage = DB::table(config('admin.database.menu_table'))->where('title', '订单管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$orderManage) {
			$orderManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '订单管理',
				'icon'       => 'iconfont icon-dingdanguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$orderManageId = $orderManage->id;
		}

		$orderList = DB::table(config('admin.database.menu_table'))->where('title', '订单列表')->where('parent_id', $orderManageId)->first();
		if (!$orderList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $orderManageId,
				'order'      => $lastOrder++,
				'title'      => '订单列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/order?status=all',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$refundManage = DB::table(config('admin.database.menu_table'))->where('title', '售后管理')->where('parent_id', $orderManageId)->first();
		if (!$refundManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $orderManageId,
				'order'      => $lastOrder++,
				'title'      => '售后管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/refund',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$commentsManage = DB::table(config('admin.database.menu_table'))->where('title', '评论管理')->where('parent_id', $orderManageId)->first();
		if (!$commentsManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $orderManageId,
				'order'      => $lastOrder++,
				'title'      => '评论管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/comments?status=show',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$pointMall = DB::table(config('admin.database.menu_table'))->where('title', '积分商城')->where('parent_id', $storeBackendParentId)->first();
		if (!$pointMall) {
			$pointStoreId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '积分商城',
				'icon'       => 'iconfont icon-shangpinshezhi-',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$pointStoreId = $pointMall->id;
		}

		$pointMallGoods = DB::table(config('admin.database.menu_table'))->where('title', '积分商品管理')->where('parent_id', $pointStoreId)->first();
		if (!$pointMallGoods) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $pointStoreId,
				'order'      => $lastOrder++,
				'title'      => '积分商品管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/point-mall/goods',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$pointMallOrders = DB::table(config('admin.database.menu_table'))->where('title', '积分订单管理')->where('parent_id', $pointStoreId)->first();
		if (!$pointMallOrders) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $pointStoreId,
				'order'      => $lastOrder++,
				'title'      => '积分订单管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/point-mall/orders?status=all',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		/*$shippingManage = DB::table(config('admin.database.menu_table'))->where('title', '物流管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$shippingManage) {
			$shippingManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '物流管理',
				'icon'       => 'iconfont icon-wuliuguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$shippingManageId = $shippingManage->id;
		}

		$shippingMethod = DB::table(config('admin.database.menu_table'))->where('title', '物流列表')->where('parent_id', $shippingManageId)->first();
		if (!$shippingMethod) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $shippingManageId,
				'order'      => $lastOrder++,
				'title'      => '物流列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/shippingmethod/company',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		$imageManage = DB::table(config('admin.database.menu_table'))->where('title', '图片管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$imageManage) {
			$imageManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '图片管理',
				'icon'       => 'iconfont icon-tupianguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$imageManageId = $imageManage->id;
		}

		$imageList = DB::table(config('admin.database.menu_table'))->where('title', '图片列表')->where('parent_id', $imageManageId)->first();
		if (!$imageList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $imageManageId,
				'order'      => $lastOrder++,
				'title'      => '图片列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/image/file?category_id=1',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		$imageCategoryManage = DB::table(config('admin.database.menu_table'))->where('title', '图片分类管理')->where('parent_id', $imageManageId)->first();
		if (!$imageCategoryManage) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $imageManageId,
				'order'      => $lastOrder++,
				'title'      => '图片分类管理',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/image/category',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}

		/*$activityManage = DB::table(config('admin.database.menu_table'))->where('title', '活动管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$activityManage) {
			$activityManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '活动管理',
				'icon'       => 'iconfont icon-tupianguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$activityManageId = $activityManage->id;
		}

		$activityList = DB::table(config('admin.database.menu_table'))->where('title', '活动列表')->where('parent_id', $activityManageId)->first();
		if (!$activityList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $activityManageId,
				'order'      => $lastOrder++,
				'title'      => '活动列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/free_event?status=valid',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}*/

		$supplierManage = DB::table(config('admin.database.menu_table'))->where('title', '供应商管理')->where('parent_id', $storeBackendParentId)->first();
		if (!$supplierManage) {
			$supplierManageId = DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $storeBackendParentId,
				'order'      => $lastOrder++,
				'title'      => '供应商管理',
				'icon'       => 'iconfont icon-erpguanli',
				'blank'      => 1,
				'uri'        => '',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		} else {
			$supplierManageId = $supplierManage->id;
		}

		$supplierList = DB::table(config('admin.database.menu_table'))->where('title', '供应商列表')->where('parent_id', $supplierManageId)->first();
		if (!$supplierList) {
			DB::table(config('admin.database.menu_table'))->insertGetId([
				'parent_id'  => $supplierManageId,
				'order'      => $lastOrder++,
				'title'      => '供应商列表',
				'icon'       => '',
				'blank'      => 1,
				'uri'        => 'store/supplier',
				'created_at' => date('Y-m-d H:i:s', time()),
				'updated_at' => date('Y-m-d H:i:s', time()),
			]);
		}
	}
}